import string
from urllib.parse import quote, quote_plus

import urllib3.util

if __name__ == '__main__':
    original_string = "tested_algorithm/1897173613233827841"
    print(f"原始字符串: {original_string}")
    encoded_string = quote_plus(original_string)
    print(f"编码后的字符串: {encoded_string}")

    original_string = "tested_algorithm/1897173613233827841"
    safe_chars = string.ascii_letters + string.digits + '_'
    encoded_string = ''.join(
        c if c in safe_chars else f"%{ord(c):02X}" for c in original_string
    )
    print(encoded_string)

